# Copyright (c) 2019 Presto Labs Pte. Ltd.
# Author: xguo

import functools
import coin.strategy.accounting.fee as accounting_fee
from coin.exchange.base.kr_rest.futures_product import (
  NormProduct, NormFuturesProduct)

@functools.lru_cache(maxsize=1024)
def get_fee_rate(product):
  if isinstance(product, NormProduct):
    maker_fee, taker_fee = accounting_fee.get_fee_rate('Spot', product.exchange, product)
  elif isinstance(product, FuturesNormProduct):
    maker_fee, taker_fee = accounting_fee.get_fee_rate('Futures', product.exchange, product)
  else:
    raise ValueError()
  return maker_fee * 1e4, taker_fee * 1e4
